<template>
  <el-card shadow="always" :body-style="{ padding: '15px' }">
    <!-- card body -->
    <el-form :inline="true">
      <el-form-item label="一级分类">
        <!-- 跳转到平台属性值页面时禁用一级,二级,三级文本框 -->
        <el-select v-model="categoryStore.c1Id" @change="c1Handler" :disabled="scene==1?true:false">
          <el-option :label="c1.name" :value="c1.id" v-for="(c1,index) in categoryStore.c1List" :key="c1.id"></el-option>
        </el-select>
      </el-form-item >
      <el-form-item label="二级分类">
        <el-select v-model="categoryStore.c2Id" @change="c2Handler" :disabled="scene==1?true:false">
          <el-option :label="c2.name" :value="c2.id" v-for="(c2,index) in categoryStore.c2List" :key="c2.id"> </el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="三级分类">
        <el-select v-model="categoryStore.c3Id" :disabled="scene==1?true:false">
          <el-option :label="c3.name" :value="c3.id" v-for="(c3,index) in categoryStore.c3List" :key="c3.id"> </el-option>
        </el-select>
      </el-form-item>
    </el-form>
  </el-card>
</template>

<script setup lang="ts">
// 引入仓库
import useCategoryStore from '@/stores/category'
import { onMounted } from 'vue'
let categoryStore = useCategoryStore()
onMounted(()=>{
    categoryStore.getC1List()
})
const c1Handler = ()=>{
    categoryStore.getC2List()
}
const c2Handler = ()=>{
    categoryStore.getC3List()
}
defineProps(['scene'])
</script>

<style scoped>
</style>